//
//  Macro.h
//  LYouSubscribeApp
//
//  Created by grx on 2018/12/10.
//  Copyright © 2018年 grx. All rights reserved.
//

#ifndef Macro_h

#define LYBASEURL @"http://bz.pk2game.com"

#define Macro_h
// 屏幕宽高
#define SCREEN_WIDTH        [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT       [UIScreen mainScreen].bounds.size.height
// 适配比例
#define ADAPTATIONRATIO     SCREEN_WIDTH / 750.0f

// 导航栏高度与tabbar高度
#define NAVBAR_HEIGHT       (IS_iPhoneX ? 88.0f : 64.0f)
#define TABBAR_HEIGHT       (IS_iPhoneX ? 83.0f : 49.0f)

// 状态栏高度
#define STATUSBAR_HEIGHT    (IS_iPhoneX ? 44.0f : 20.0f)

#define WeakSelf(weakSelf) __weak typeof(self) weakSelf = self

#define MainWindows [[[UIApplication sharedApplication] delegate] window]

//判断iPhone X
#define isIPhoneX     (SCREEN_WIDTH == 375.f && SCREEN_HEIGHT == 812.f)
#define TabbarSafeBottomMargin         (isIPhoneX ? 34.f : 0.f)
#define NavigbarTopMargin              (isIPhoneX ? 24.f : 0.f)
#define kNavigationBarHeight    (isIPhoneX ? 68.f : 44.f)
#define kTabBarHeight           (49.f)
#define navBarHeight           (isIPhoneX ? 88.f : 64.f)//状态栏高度

// 判断是否是iPhone X系列
#define IS_iPhoneX      ([UIScreen instancesRespondToSelector:@selector(currentMode)] ?\
(\
CGSizeEqualToSize(CGSizeMake(375, 812),[UIScreen mainScreen].bounds.size)\
||\
CGSizeEqualToSize(CGSizeMake(812, 375),[UIScreen mainScreen].bounds.size)\
||\
CGSizeEqualToSize(CGSizeMake(414, 896),[UIScreen mainScreen].bounds.size)\
||\
CGSizeEqualToSize(CGSizeMake(896, 414),[UIScreen mainScreen].bounds.size))\
:\
NO)
// 来自YYKit
#ifndef weakify
#if DEBUG
#if __has_feature(objc_arc)
#define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object;
#endif
#else
#if __has_feature(objc_arc)
#define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
#endif
#endif
#endif

#ifndef strongify
#if DEBUG
#if __has_feature(objc_arc)
#define strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object;
#endif
#else
#if __has_feature(objc_arc)
#define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
#endif
#endif
#endif

/*! 颜色 */
#define ColorWithRGBA(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define ColorWithRGB(r,g,b) ColorWithRGBA(r,g,b,1)
#define ColorWithHexRGBA(rgbValue, alphaValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue]
#define ColorWithHexRGB(rgbValue) ColorWithHexRGBA(rgbValue,1.0)

/* 平方-细体 */
#define LYFont_Semibold(font) [UIFont fontWithName:@"PingFangSC-Semibold"size:font]
#define LYFont_Medium(font) [UIFont fontWithName:@"PingFangSC-Medium"size:font]
#define LYFont_Regular(font) [UIFont fontWithName:@"PingFangSC-Regular"size:font]

/**  审核开关 */
#define StandardUserDefaults [NSUserDefaults standardUserDefaults]
#define ISCheckIOS    [StandardUserDefaults objectForKey:@"CHECKIOS"]
/**  视频自动播放 */
#define ISAUTOPLAY    [StandardUserDefaults objectForKey:@"ISAUTOPLAY"]
/** 是否已经订阅 */
#define ISHAVEBUYMEMBER    [StandardUserDefaults objectForKey:@"ISHAVEBUYMEMBER"]

/** 内购ID */
#define APPSTORYBUYID @"bizhi001_233"
//共享密钥
#define SHAREKEY @"ff1664c1f9d043da99e0b44200a44df4"
//AppStore ID
#define APPSTOREID @"1448095121"

//主页全屏广告ID
#define LYHomeADId @"ca-app-pub-6719639781124001/9290941595"
//详情插播广告ID
#define LYDetailADId @"ca-app-pub-6719639781124001/4086104071"

#endif /* Macro_h */
